const fs = require('fs').promises;
const path = require('path');
const marked = require('marked');
const TerminalRender = require('marked-terminal')
const chalk = require('chalk');

marked.setOptions({
  renderer: new TerminalRender({
    heading: function (text) {
      return chalk.green.bold(text);
    },
    showSectionPrefix: false
  })
})

// async function readFile() {
//   return fs.readFile(path.resolve(__dirname, '../README.md'), 'utf8')
// }

// readFile().then(data => {
//   console.log(marked(data))
// })

const data = `
# 示例项目

## 开始

### 使用 node markd 项目

- \`yarn\`
- \`node node/mark-md.js\`
`
console.log(marked(data))